package com.testbank.practise.sqltables;

import android.content.ContentValues;

public class TestScoresTable {

	public static final String TABLE_NAME = "TestScores";
	
	public static final String KEY_ATTEMPT_NUM = "attempNum";
	public static final String KEY_SCORE = "score";
	public static final String KEY_TIME_TAKEN = "timeTaken";
	public static final String KEY_COMPLETED = "completed";
	public static final String KEY_STOPPED_AT = "stoppedAt";
	
	public static final String CREATE = "CREATE TABLE " + TABLE_NAME + " ("
								+ KEY_ATTEMPT_NUM + " integer primary key, "
								+ KEY_SCORE + " integer, "
								+ KEY_TIME_TAKEN + " integer, "
								+ KEY_COMPLETED + " integer, "
								+ KEY_STOPPED_AT + " integer);";
	
	public static final int KEY_ATTEMPT_NUM_INDEX = 0;
	public static final int KEY_SCORE_INDEX = 1;
	public static final int KEY_TIME_TAKEN_INDEX = 2;
	public static final int KEY_COMPLETED_INDEX = 3;
	public static final int KEY_STOPPED_AT_INDEX = 4;
	
	public static ContentValues GetCVRow(long attemptNum, int score, int timeTaken, int completed, int stoppedAt) {
		//store new test score table row
		ContentValues newScoreAttemptRow = new ContentValues();
		newScoreAttemptRow.put(KEY_ATTEMPT_NUM, attemptNum);
		newScoreAttemptRow.put(KEY_SCORE, score);
		newScoreAttemptRow.put(KEY_TIME_TAKEN, timeTaken);
		newScoreAttemptRow.put(KEY_COMPLETED, completed);
		newScoreAttemptRow.put(KEY_STOPPED_AT, stoppedAt);
		
		return newScoreAttemptRow;
	}
	
}
